
// #ifndef VUE3
import Vue from 'vue'
import App from './App'
import uView from 'uview-ui'
import { $http } from '@escook/request-miniprogram'

Vue.use(uView);

uni.$http=$http
//根路径
// 本地路径
$http.baseUrl='http://localhost:8081'
// 我的服务器路径
// $http.baseUrl='http://39.106.152.4:8080'
// 请求拦截器
$http.beforeRequest=function(options){
	if ((options.url.indexOf('/users/currentUser') !== -1)||(options.url.indexOf('/articles/publish') !== -1)||
	(options.url.indexOf('/logout') !== -1)||(options.url.indexOf('/comments/create/change') !== -1)||
	(options.url.indexOf('/faceAuth') !== -1)||(options.url.indexOf('/login/changImage') !== -1)) {
	    options.header = {
	    'Authorization': uni.getStorageSync('token'),
	    }
		// console.log(uni.getStorageSync('token'));
	}
	uni.showLoading({
		title:'加载'
	})
}
// 响应拦截器
$http.afterRequest=function(){
	uni.hideLoading()
}
uni.$showMsg=function(title="数据加载失败",duration=1500){
	uni.showToast({
		title,
		duration,
		icon:'none'
	})
}


Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import App from './App.vue'
import Logon1VueHtml from './pages/Logon1/Logon1.vue.html';
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif